package org.jetlinks.community.standalone.entry;


import lombok.Data;
import org.h2.util.StringUtils;
import org.jetlinks.community.device.entity.DeviceProductEntity;

@Data
public class ThingsJsCategoryDto {

    private String className;

    private String icon;

    public static ThingsJsCategoryDto transformFromDeviceProduct(DeviceProductEntity deviceProduct) {
        ThingsJsCategoryDto dto = new ThingsJsCategoryDto();
        dto.setIcon(StringUtils.isNullOrEmpty(deviceProduct.getPhotoUrl()) ?"":deviceProduct.getPhotoUrl());
        dto.setClassName(deviceProduct.getName());
        return dto;
    }
}
